#ifndef RAYTRACER_H_
#define RAYTRACER_H_

#include "Scene.h"
#include <glut.h>
#include <cmath>


namespace RayTracing
{
	class RayTracer
	{
		Scene* current_scene;
		int maxDepth;
		static const int image_h = 900;
		static const int image_w = 900;

	public:

		float frameBuffer[image_w][image_h][3];

		RayTracer() : current_scene( 0 ) , maxDepth( 0 ){}

	    RayTracer( Scene* _scene, int _maxDepth ) : current_scene( _scene ) , maxDepth( _maxDepth ){}

		void setScene( Scene* _scene );

		void renderScene();

		Properties::Color rayTrace( const Geometry::Ray& r , int depth );

		Geometry::Object* findClosestObject( const Geometry::Ray& _source,
			                                 const std::vector<Geometry::Object*>& _objectList, 
											 Geometry::Point& inter_point );

		void clearFrameBuffer();
		void setFramebuffer(int x, int y, float R, float G, float B);

		inline int getHeight() { return image_h; };
		inline int getWidth() { return image_w; };
	};
}

#endif